package com.trkj.dao.jpa;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojos.CcDeduct;

public interface CcDeductDAO extends CrudRepository<CcDeduct, Long> {

	@Query("select c from CcDeduct c  where c.dpaymentid=?1 order by c.dedate")
	public List<CcDeduct> findByOneCcPatient(Pageable pageable,BigDecimal dpaymentid);
	@Query("select count(*) from CcDeduct c  where c.dpaymentid=?1")
	public long findByCount(BigDecimal dpaymentid);
	
	@Query("select c from CcDeduct c  where c.dpaymentid=?1 and c.dedate between ?2 and ?3 order by c.dedate")
	public List<CcDeduct> findBydedate(Pageable pageable,BigDecimal dpaymentid,Date olddate,Date newdate);
	@Query("select count(*) from CcDeduct c  where c.dpaymentid=?1 and c.dedate between ?2 and ?3")
	public long findBydedateCount(BigDecimal dpaymentid,Date olddate,Date newdate);
}
